import Vue from 'vue'
import Router from 'vue-router' 
Vue.use(Router)
let router=new Router({
	routes: [{
				path: '/',
				redirect: "/guide"
			},
			{
				path: '/search',
				name: 'Search',
				component: () => import('@/views/search')
			},
			{
				path: '/guide',
				name: 'guide',
				component: () => import('@/views/Guide')
			},
			
			{
				path: '/second',
				name: 'second',
				component: () => import('@/views/Second')
			},
			{
				path:"/register",
				name:"Register",
				component:()=>import("@/views/register")
			},
			
			{
				path:"/login",
				name:"Login",
				component:()=>import("@/views/login")
			},
			{
				path:"/goodsDetail/:id",
				name:"GoodsDetail",
				component:()=>import("@/views/goodsDetail")
			},
			{
				path:"/goodsEdit",
				name:"GoodsEdit",
				component: () => import('@/views/goodsEdit'),
				meta:{
					title:"编辑"
				}
			},
			{
				path:"/setting",
				name:"Setting",
				component:()=>import('@/views/setting'),
				meta:{
					title:"设置"
				}
			},
			{
				path:"/coupon",
				name:"Coupon",
				component:()=>import('@/views/coupon'),
				meta:{
					title:"优惠券"
				}
			},
			{
				path:"/share",
				name:"Shares",
				component:()=>import('@/views/share'),
				meta:{
					title:"分享"
				}
			},
			{
				path: "/index",
				redirect: "/home",
				name: 'Index',
				children: [{
						path: '/cart',
						name: 'Cart',
						component: () => import('@/views/cart'),
						meta:{
							title:"购物袋"
						}
					}, 
					{
						path: '/classify',
						redirect: "/classifySift",
						name: 'Classify',
						component: () => import('@/views/classify'),
						
						children:[{
								path: "/classifySift",
								name: "ClassifySift",
								component: () => import("@/views/ClassifySift"),
								meta:{
									title:"分类"
								},
						},
						{
								path: "/classifyBrand",
								name: "ClassifyBrand",
								component: () => import("@/views/ClassifyBrand")
						},
						{
								path: "/classifyMadam",
								name: "ClassifyMadam",
								component: () => import("@/views/ClassifyMadam")
						},
						{
								path: "/classifyMan",
								name: "ClassifyMan",
								component: () => import("@/views/ClassifyMan")
						},
						{
								path: "/classifyBeauty",
								name: "ClassifyBeauty",
								component: () => import("@/views/ClassifyBeauty")
						},
						{
								path: "/classifyHome",
								name: "ClassifyHome",
								component: () => import("@/views/ClassifyHome")
						},
						{
								path: "/classifyBaby",
								name: "ClassifyBaby",
								component: () => import("@/views/ClassifyBaby")
						}]
					},
					{
						path: '/mine',
						name: 'Mine',
						component: () => import('@/views/mine'),
						meta:{
							title:"我的"
						}
					},
					
					{
						path: '/usedLuxury',
						name: 'UsedLuxury',
						component: () => import('@/views/usedLuxury'),
						meta:{
							title:"二手奢品"
						}
					},
					{
						path: "/home",
						name: "Home",
						component: () => import("@/views/home"),
						meta:{
							title:"首页"
						}
					}
				],
				component: () => import('@/views/index')
			}


		] 
})

router.beforeEach((to,from,next)=>{
	if(to.meta.title){
		document.title=to.meta.title
	}
	next()
})

export default router
